import React from "react"
import {connect} from 'react-redux'

class ShoppingCar extends React.Component{
   constructor(props){
       super(props)
       console.log(props)
   }
   render(){
       const list=this.props.shoppingcar.map((item)=>{
          return <li>ID:{item.id} name:{item.name} price:{item.price} count:{item.count}</li>
       })
       return(
           <div>
              购物车
              <ul>
                  {list}
              </ul>
           </div>
       )
   }
}


function mapStateToProps(state){
    return {
        shoppingcar:state.shoppingcar.item
    }
 }
 function mapDispatchToProps(dispatch){
    return{
       
    }
 }
export default connect(mapStateToProps,mapDispatchToProps)(ShoppingCar);
